//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __SYS_ARCH_H_
#define __SYS_ARCH_H_

typedef void* sys_sem_t;//
typedef void* sys_mbox_t;//
typedef void* sys_thread_t;//
typedef void* sys_prot_t;//

#ifdef __cplusplus
extern "C" sys_mbox_t SYS_MBOX_NULL;
extern "C" sys_sem_t  SYS_SEM_NULL;
extern "C" sys_mbox_t sys_mbox_new(void);
extern "C" void sys_mbox_post(sys_mbox_t mbox, void *msg);
extern "C" u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout);
extern "C" void sys_mbox_free(sys_mbox_t mbox);
extern "C" sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio);
extern "C" sys_sem_t sys_sem_new(u8_t count);
extern "C" void sys_sem_signal(sys_sem_t sem);
extern "C" void sys_sem_free(sys_sem_t sem);
extern "C" u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout);
extern "C" sys_prot_t sys_arch_protect(void);
extern "C" void sys_arch_unprotect(sys_prot_t pval);
extern "C" struct sys_timeouts *sys_arch_timeouts(void);
extern "C" int triggerevent(int event);
#else
extern sys_mbox_t SYS_MBOX_NULL;
extern sys_sem_t  SYS_SEM_NULL;
sys_mbox_t sys_mbox_new(void);
void sys_mbox_post(sys_mbox_t mbox, void *msg);
u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout);
void sys_mbox_free(sys_mbox_t mbox);
sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio);
sys_sem_t sys_sem_new(u8_t count);
void sys_sem_signal(sys_sem_t sem);
void sys_sem_free(sys_sem_t sem);
u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout);
sys_prot_t sys_arch_protect(void);
void sys_arch_unprotect(sys_prot_t pval);
struct sys_timeouts *sys_arch_timeouts(void);
int triggerevent(int event);
#endif

#endif //__SYS_ARCH_H_
